package com.example.dream.satrt.controller;

import com.example.dream.satrt.bean.UserTest;
import com.example.dream.satrt.service.UserService;
import com.example.dream.satrt.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService=new UserServiceImpl();
//    @RequestMapping("/test")
//    public String toPage() {
//        return "login";
//    }
    @RequestMapping("/findById")
    public List<UserTest> findById(Integer id){
        return userService.findById(id);
    }
    @RequestMapping("/insert")
    public boolean insert(HttpServletRequest request,HttpServletResponse response,UserTest entity){
        return userService.insert(entity);
    }
    @RequestMapping("/update")
    public boolean update(UserTest entity){
        return userService.update(entity);
    }
    @RequestMapping("/delete")
    public boolean delete(Integer id){
        return userService.delete(id);
    }
}
